package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.CustomerTransfer;
import cn.wolfcode.crm.qo.CustomerTransferQueryObject;
import cn.wolfcode.crm.qo.JsonResult;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.ICustomerTransferService;
import com.github.pagehelper.PageInfo;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/customerTransfer")
public class CustomerTransferController {
    @Autowired
    private ICustomerTransferService customerTransferService;

    @RequestMapping("/list")
    public String list(@ModelAttribute("qo") CustomerTransferQueryObject queryObject, Model model){
        PageInfo<CustomerTransfer> pageResult = customerTransferService.selectByQuery(queryObject);
        //List<CustomerTransfer> list = customerTransferService.getAll();
        model.addAttribute("result",pageResult);
        return "customerTransfer/list";
    }



    @RequestMapping("/input")
    public String input(Long id, Model model){
        return "customerTransfer/input";
    }

    @RequestMapping("/saveOrUpdate")
    public String saveOrUpdate(CustomerTransfer customerTransfer){
            customerTransferService.saveOrUpdate(customerTransfer);
            return "redirect:/customer/potentialList.do";
    }
    @RequestMapping("/absorb")
    public String absorb(CustomerTransfer customerTransfer){
            customerTransferService.saveOrUpdate(customerTransfer);
            return "redirect:/customer/potentialList.do";
    }

}
